﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %>

<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">

    <h2>KillEvent</h2>
    
    <a id="t" href="#" onclick="return click1();">Click ME</a>  
<br />
    <span id="p">
    </span>
<br />
    
    <button id="ub1">Unbind</button>
    <button id="ub2">Unbind2</button>
    <button id="b">Bind</button>
    <button id="clear">Clear</button>
  
<script type="text/javascript">
	function click1() {
		$("#p").text($("#p").text() + "-click1");
		return false;
	}
	function click2(e) {
		$("#p").text($("#p").text() + "-click2");
		if (window.event) event.cancelBubble = true;
		e.stopPropagation();
			document.getElementById("t").onclick =null;
		return false;
	}
	function clear() {
		$("#p").text("");
		return false;
	}

	$(function() {
		$("#ub1").click(function() {
			$("#t").unbind("click");
		});
		$("#ub2").click(function() {
			document.getElementById("t").onclick =null;
		});
		$("#b").click(function() {
			$("#t").bind("click", click2);
		});
		$("#clear").click(clear);
	});
</script>

</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
